import React, {Component, PropTypes} from 'react';
import {
    Router,
    Route,
    IndexRoute,
    browserHistory,
    hashHistory,
    Redirect
} from 'react-router';

import MapIndex from './Component/map'; //首页

import Path from './Component/Path'
import DeviceList from './Component/DeviceList'

import AddDevice from './Component/AddDevice'

import Gotoactive from './Component/gotoactive'
import VerifyText from './Component/verifyText'
import Success from './Component/success'
import kaoqin from './Component/kaoqin'
import Safetyarea from './Component/Safetyarea'
import Addarea from './Component/Addarea'
//import Demo from './Component/demo'
import Guardian from './Component/guardian'
import AddGuardian from './Component/guardian/addGuardian'
import More from './Component/More'
//import login from './Component/login'
//import register from './Component/register'
//import ForgetPwd from './Component/ForgetPwd'
import model from './Component/common/model'
import Authen from './Component/authen'
import Ldemo from './Component/Ldemo'
import Address from './Component/Address'
import ChangeDevice from './Component/ChangeDevice'
import Statistics from './Component/Statistics'
import Attendance from './Component/Attendance'
import Disturb from './Component/Disturb'
import SelectionCycle from './Component/SelectionCycle'
import BuyDevice from './Component/BuyDevice'
import Pay from './Component/pay'
import BuyOrder from './Component/orderLists'
//import Eyijiao from './Component/Eyijiao'
//<Route path="/eyijiao(/:url)" component={Eyijiao}/>
/**
 * (路由根目录组件，显示当前符合条件的组件)
 *
 * @class Roots
 * @extends {Component}
 */
class Roots extends Component {
    render() {
        return (
            <div>{this.props.children}</div>
        );
    }
}

var history = hashHistory;

const RouteConfig = (
    <Router path="/" history={history}>
        <IndexRoute component={MapIndex}/>
        <Route path="/path/:babyid/:lng/:lat" component={Path}/>
        <Route path="/map/(:token)(/:userid)" component={MapIndex}/>
        <Redirect from="messages/:id" to="/messages/:id"/>
        <Route path="/deviceList" component={DeviceList}/>
        <Route path="/AddDevice(/:islogin)" component={AddDevice}/>
        <Route path="/Gotoactive/:telephone/:mdtid/:code" component={Gotoactive}/>
        <Route path="/VerifyText/:admintelephone/:mdtid/:deviceid/:telephone" component={VerifyText}/>
        <Route path="/Success/:time" component={Success}/>
        <Route path="/kaoqin/:babyid(/:back)" component={kaoqin}/>
        <Route path="/Safetyarea/:babyid" component={Safetyarea}/>
        <Route path="/Addarea/:regionid/:radius/:centerlng/:centerlat/:name" component={Addarea}/>
        <Route path="/Guardian/:babyid" component={Guardian}/>
        <Route path="/AddGuardian/:babyid/:guardianid/:familystatus" component={AddGuardian}/>
        <Route path="/More/:babyid" component={More}/>
        <Route path="/model" component={model}/>
        <Route path="/ChangeDevice/:telephone/:mdtid/:devicetype" component={ChangeDevice}/>
        <Route path="/authen/:phone" component={Authen}/>
        <Route path="/Ldemo" component={Ldemo}/>
        <Route path="/Address(/:shengji)" component={Address}/>
        <Route path="/Statistics" component={Statistics}/>
        <Route path="/attendance/:token" component={Attendance}/>
        <Route path="/Disturb(/:cycles)" component={Disturb}/>
        <Route path="/SelectionCycle" component={SelectionCycle}/>
        <Route path="/BuyDevice(/:back)" component={BuyDevice}/>
        <Route path="Pay/:babyid/:deviceid(/:noback)" component={Pay}/>
        <Route path="buyOrder" component={BuyOrder}/>
        <Route path="*" component={MapIndex} />
    </Router>
);

export default RouteConfig;
